﻿<demos:DemoItem x:Class="DemoApplication.Demos.Controls.IconColorTransforms"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:bh="http://www.brokenhouse.co.uk/wpf"
                xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
                xmlns:demos="clr-namespace:DemoApplication.Demos"
                Group="Controls" Label="Color Transforms">
    

    <DockPanel Margin="1">
        <StackPanel DockPanel.Dock="Top" Margin="2" >
            <TextBlock TextWrapping="Wrap" FontWeight="Bold" FontSize="14">
                Color Transforms
            </TextBlock>
            <TextBlock TextWrapping="Wrap" Margin="0,5,0,0">      
                Color transforms are used to subtly alter the appearance
                of an icon. These transformation
                are used within the <Bold>ActiveIcon</Bold> element
                to change the icon appearance based on the state of its
                button container.
            </TextBlock>
            <TextBlock TextWrapping="Wrap" Margin="0,5,0,0">    
                The following matrix shows how the icon
                    in the top-left changes in appearence when
                    the amount of desaturation is increased (going
                    down) and the gamma correction factor is 
                    decreased
            </TextBlock>
        </StackPanel>

        <Grid HorizontalAlignment="Center" VerticalAlignment="Top" Margin="10" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            
            <StackPanel Orientation="Horizontal" Grid.Row="0" VerticalAlignment="Center">
                <StackPanel.LayoutTransform>
                    <RotateTransform Angle="-90"/>
                </StackPanel.LayoutTransform>
                <TextBlock Text="Increasing Saturation"/>
                <Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FF000000" Margin="2,4,0,0" Data="M0,10 L18,10 L18,12 L30,10 L18,8 L18,10"
                      Height="8"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Center">
                <TextBlock Text="Increasing Gamma"/>
                <Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FF000000" Margin="2,4,0,0" Data="M0,10 L18,10 L18,12 L30,10 L18,8 L18,10"
                      Height="8"/>
            </StackPanel>
            
            <ItemsControl Grid.Row="0" Grid.Column="1" Margin="2"  ItemsSource="{Binding TransformData}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <ItemsControl ItemsSource="{Binding .}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <bh:Icon Width="32" Height="32" SnapsToDevicePixels="True" Margin="3" Source="{x:Static bh:TaskIcons.Warning}">
                                        <bh:Icon.ColorTransform>
                                            <bh:ColorTransformGroup>
                                                <bh:GammaCorrectionTransform Gamma="{Binding GammaCorrection}"/>
                                                <bh:DesaturationTransform Amount="{Binding DesaturationAmount}"/>
                                            </bh:ColorTransformGroup>
                                        </bh:Icon.ColorTransform>
                                    </bh:Icon>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Horizontal" IsItemsHost="True"/>
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                        </ItemsControl>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </Grid>

    </DockPanel>
</demos:DemoItem>
